/*
 * cmconstants.h
 *
 *  Created on: Feb 26, 2011
 *      Author: Mo
 */

/**
 * The different constants used in the code.
 */

//NOTE: THE ORIGIN FOR COUNTING ROWS AND COLS IS ON TOP LEFT (
#pragma once

#define OUTOFBOARD 1		//!< The pixel value corresponding to Out of border; used for the neighbor value of border cells.
#define MROWS 25			//!< Number of rows in the matrix (the same as number of rows of pixels in the image).
#define MCOLS 20			//!< Number of columns in the matrix (the same as number of columns of pixels in the image).
#define BLACK 1				//!< The pixel value corresponding to black
#define WHITE 0				//!< The pixel value corresponding to white
#define NEIGHBORHOODSIZE0 1	//!< The size of Moore neighborhood with radius = 0
#define NEIGHBORHOODSIZE1 9	//!< The size of Moore neighborhood with radius = 1
#define NEIGHBORHOODSIZE2 25//!< The size of Moore neighborhood with radius = 2
#define NEIGHBORHOODSIZE3 49//!< The size of Moore neighborhood with radius = 3. WHY DO WE NEED THIS SHIT? (2n+1)^2
#define CELLSTATES OUTOFBOARD+1		//!< Number of different states (Black, White, out of border, etc) a cell can have.
#define NRADIUS 1			//!< Neighborhood radius. 0: only the cell itself. 1: it's immidiate surronding cells, 2: 25 cells, etc (neighbor cells: (2*NRADIUS+1)^2)
#define BITS_PER_NBR OUTOFBOARD		//!< Number of bits we need to store the state of a [neighbor] cell. it is 2 if we store the "out of border" state by anything other than 0 or 1.
#define COMMENTS_OFF		//!< Controls the messages in the run window.
#define SAVE_BLACKS_ONLY	//!< Different methods save only rules with "1" in THEN part. Ignoring the rules with "0" for their "THEN" part.
#define DEBUG_ON
#define BITS_PER_PIXEL 8	//!< Our images are 256-level gray scale, each pixel's intensity is stored in 8-bits.
#define BITS_PER_ROWCOL 5	//!< Number of bits to store either ROW or COL. This value is 5 for 20x25 images.
#define FITNESS_ALL_PIXELS	//!< Tells to count is all the pixels when calculating the fitness of a SEARuleSet object. This might take a long time for large pics.
#define GRAYCALE_LEVELS 256 //!< Number of gray scale levels in the bmp files.
#define MSVC
#define VC110
/** Used to tell the relative coordinate of a point to a rectangle */
enum relativeLocation
{
	rlInside,
	rlTopLeft,
	rlTop,
	rlTopRight,
	rlRight,
	rlBottomRight,
	rlBottom,
	rlBottomLeft,
	rlLeft,
};

/** Used to tell the direction of the possible paths that start from a given coordinate in a rectangle and
 *  do not hit any other coordinate in that rectangle.
 */
enum emptyDirection
{
	toNone,
	toUp,
	toRight,
	toDown,
	toLeft,
	toUpRight,
	toUpDown,
	toUpLeft,
	toRightDown,
	toRightLeft,
	toDownLeft,
	toRightDownLeft,
	toUpDownLeft,
	toUpRightLeft,
	toUpRightDown,
	toUpRightDownLeft
};

enum color
{
	black,
	white,
	colorNum
};

enum Rectangle2FormationAlgorithmType
{
	topdown,
	bottomup,
	evolution
};

enum ErrorCodes
{
	SUCCESS,
	INVALID_INPUT_PARAMETERS,
};



#ifdef DEBUG_ON
	#define DEBUG(x,y); x<<y<<endl;
	#define LOG(x); logFile<<x;
	#define LOGLINE(x); logFile<<x<<endl;
#else
	#define DEBUG(x,y);
#endif

#ifdef FITNESS_ALL_PIXELS
#else
	#define FITNESS_SAMPLE_PIXELS 50
#endif

#ifndef MSVC
#define GCC
#define __int64  uint64_t
#endif